import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: {
      path: '/film'
    }
  },
  {
    path: '/film',
    name: 'Film',
    component: () => import('../views/Film.vue'),
    children: [
      {
        path: 'hotplaying',
        component: () => import('@/views/film/HotPlaying')
      },
      {
        path: 'willplaying',
        component: () => import('@/views/film/WillPlaying')
      },
      {
        path: '',
        redirect: 'hotplaying'
      },
    ]
  },
  {
    path: '/cinema',
    name: 'Cinema',
    component: () => import('../views/Cinema.vue'),
  },
  {
    path: '/cinema/city',
    name: 'City',
    component: () => import('../views/cinema/City.vue')
  },
  {
    path: '/cinema/search',
    name: 'Search',
    component: () => import('../views/cinema/Search.vue')
  },
  {
    path: '/cinema/cinemainfo/:id',
    name: 'CinemaInfo',
    component: () => import('../views/cinema/CinemaInfo.vue')
  },
  {
    path: '/detail/:id',
    name: 'Detail',
    component: () => import('../views/Detail.vue')
  },
  {
    path: '/consult',
    name: 'Consult',
    component: () => import('../views/Consult')
  },
  {
    path: '/mine',
    name: 'Mine',
    component: () => import('../views/Mine')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/mine/Login')
  },
  {
    path: '/setting',
    name: 'Setting',
    component: () => import('../views/mine/Setting')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
